{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/check-if-it-is-a-straight-line/\n",
    "\n",
    "\n",
    "Runtime: 60 ms, faster than 70.87% of Python3 online submissions for Check If It Is a Straight Line.\n",
    "Memory Usage: 14.3 MB, less than 5.11% of Python3 online submissions for Check If It Is a Straight Line.\n",
    "\n",
    "\n",
    "```python\n",
    "class Solution:\n",
    "    def checkStraightLine(self, coordinates: List[List[int]]) -> bool:\n",
    "        m = 3\n",
    "        for i in range(len(coordinates)):\n",
    "            if i < len(coordinates) - m+1:\n",
    "                combination = coordinates[i:i+m]\n",
    "                x1 = combination[0][0]\n",
    "                y1 = combination[0][1]\n",
    "                x2 = combination[1][0]\n",
    "                y2 = combination[1][1]\n",
    "                x3 = combination[2][0]\n",
    "                y3 = combination[2][1]\n",
    "                if not ((x2-x1)*(y3-y2) == (x3-x2)*(y2-y1)):\n",
    "                    return False\n",
    "        return True\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
